package com.aldobucchi.range
{
	
	import com.aldobucchi.utils.AbstractTest;


	public class RangeMatcherTest extends AbstractTest
	{
		
		
		public function testMisc( ):void
		{
		
			var rm:RangeMatcher = new RangeMatcher( );
			rm.rangeSet = RangeSet.fromSeries( [0, 10, 20] );
			
			var r_0_10:Range = rm.rangeSet.ranges[ 0 ] as Range;
			var r_10_20:Range = rm.rangeSet.ranges[ 1 ] as Range;
			

				assertEquals( rm.matchedRange , null );
			

			rm.value = 0;
				assertEquals( rm.matchedRange , r_0_10 );
					
			rm.value = 5;				
				assertEquals( rm.matchedRange , r_0_10 );

			rm.value = 10;				
				assertEquals( rm.matchedRange , r_10_20 );

			rm.value = 15;				
				assertEquals( rm.matchedRange , r_10_20 );

			rm.value = 20;				
				assertEquals( rm.matchedRange , null );
		




			rm.rangeSet = RangeSet.fromSeries( [ 0, 20, 40 ] );

			var r_20_40:Range = rm.rangeSet.ranges[ 1 ] as Range;


				assertEquals( rm.matchedRange , r_20_40 );


		}
		
		
	}
}